/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author tra
 */
@Entity
@Table(name = "ARTIST_MUSICGROUP")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ArtistMusicgroup.findAll", query = "SELECT a FROM ArtistMusicgroup a"),
    @NamedQuery(name = "ArtistMusicgroup.findByArtistMgId", query = "SELECT a FROM ArtistMusicgroup a WHERE a.artistMgId = :artistMgId")})
public class ArtistMusicgroup implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ARTIST_MG_ID")
    private Long artistMgId;
    @JoinColumn(name = "MUSICGROUP_ID", referencedColumnName = "MUSICGROUP_ID")
    @ManyToOne(optional = false)
    private Musicgroup musicgroupId;
    @JoinColumn(name = "ARTIST_ID", referencedColumnName = "ARTIST_ID")
    @ManyToOne(optional = false)
    private Artist artistId;

    public ArtistMusicgroup() {
    }

    public ArtistMusicgroup(Long artistMgId) {
        this.artistMgId = artistMgId;
    }

    public Long getArtistMgId() {
        return artistMgId;
    }

    public void setArtistMgId(Long artistMgId) {
        this.artistMgId = artistMgId;
    }

    public Musicgroup getMusicgroupId() {
        return musicgroupId;
    }

    public void setMusicgroupId(Musicgroup musicgroupId) {
        this.musicgroupId = musicgroupId;
    }

    public Artist getArtistId() {
        return artistId;
    }

    public void setArtistId(Artist artistId) {
        this.artistId = artistId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (artistMgId != null ? artistMgId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ArtistMusicgroup)) {
            return false;
        }
        ArtistMusicgroup other = (ArtistMusicgroup) object;
        if ((this.artistMgId == null && other.artistMgId != null) || (this.artistMgId != null && !this.artistMgId.equals(other.artistMgId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.ArtistMusicgroup[ artistMgId=" + artistMgId + " ]";
    }
    
}
